/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.bayu.controller;


import com.bayu.services.dao.PfrekapDao;
import com.bayu.services.entity.Pfrekap;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *
 * @author Bayu
 */

@Controller
@RequestMapping("/pfrekap-input.htm")
public class PfRekapInput {
    PfrekapDao pfrekapDao;
    @Autowired
    private void setPfDao(PfrekapDao pfrekapDao){
      this.pfrekapDao = pfrekapDao;
    }

     @RequestMapping(method = RequestMethod.GET)
    public void displayForm(ModelMap map,String id){

    }

    @RequestMapping(method = RequestMethod.POST)
    public String proccessForm(@ModelAttribute("Pfrekap") Pfrekap pf , BindingResult result,ModelMap map, String date,HttpServletRequest req){
            
            this.pfrekapDao.save(pf);
            return "redirect:view-pfrekap-data.htm?msg=Data has been updated";


    }

}
